package kr.co.boogui.service;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import kr.co.boogui.dao.CinemaDAO;
import kr.co.boogui.model.CinemaVO;

public class CinemaRegistryService {
	
	public static boolean cinemaRegistry(HttpServletRequest req) throws IOException {
		boolean result = false;
		CinemaVO c = new CinemaVO();
		req.setCharacterEncoding("UTF-8");
		int theater = Integer.parseInt(req.getParameter("theater"));
		for (int i = 1; i<=theater; ++i){
			c.setCineaddr(req.getParameter("addr1")+" "+req.getParameter("addr2"));
			c.setCinename(req.getParameter("cinename"));
			c.setTheater(i+"관");
			if (CinemaDAO.insertCinema(c)) result = true;
		}		
		
		return result;
	}
}
